# li = int('0001000')
# print(li)
# print(type(li))
# # li+'0'
# print(li+'0')

# class Solution:
#     def reverseBits(self, n: int) -> int:
#         n = int(n)
#         number = ''
#         sumber = 0
#         while n % 10:
#             if n % 10 == 1:
#                 number = number + '1'
#             else:
#                 number = number + '0'
#             n = n // 10
#         number = int(number)
#         while number % 10:
#             sumber = sumber * 2 + number % 10
#             number = number // 10
#         return sumber
#
#
# y = Solution()
# s= y.reverseBits('00000010100101000001111010011100')

s= 'dweafewa'
def sawp(x,y):
    tmp=x
    x=y
    y=tmp
    return


# len(s)
# s = s.replace('d', 'a')
# print(s.find('w'))
# # s[0]='a'
# print(s)

class Solution:
    def reverseBits(self, n: int) -> int:
        n = bin(n)[2:]
        while len(n) < 32:
            n = '0' + n
        sumber = 0
        tag = []
        i = 0
        while i < 32:
            i = n.find('0', i)
            if i not in tag:
                tag.append(i)

            else:
                break
            i += 1

        for i in range(len(n)):
            if i not in tag:
                sumber += 2 ** i
        return sumber


# y = Solution()
# s= y.reverseBits(964176192)
# lution()
# # s= y.reve

# s = '11111'
# print('0'+s)